'use strict';

module.exports = app => {
  const { INTEGER, DATE, STRING } = app.Sequelize;

  const UserQuestion = app.model.define('user_question', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    user_id: STRING(100),
    question_id: INTEGER,
    title: STRING(100),
    content: STRING(255),
    create_time: DATE,
    update_time: DATE,
    delete_time: DATE,
  }, {
    defaultScope: {
      attributes: {
        exclude: [ 'delete_time', 'update_time' ],
      },
    },
    timestamps: true,
    paranoid: true,
    createdAt: 'create_time',
    updatedAt: 'update_time',
    deletedAt: 'delete_time'
  });
  return UserQuestion;
};
